import 'dart:convert';
import 'package:ichinesereader/exam/dto/assessment.response.dart';
import 'package:ichinesereader/models/evaluation/evaluationClassReportResult.dart';

EvaluationBookReportResult evaluationBookReportResultFromJson(String str) =>
    EvaluationBookReportResult.fromJson(json.decode(str));
String evaluationBookReportResultToJson(EvaluationBookReportResult data) =>
    json.encode(data.toJson());

class EvaluationBookReportResult {
  EvaluationBookReportResult({
    this.status,
    this.message,
    this.result,
  });

  int? status;
  String? message;
  Result? result;

  factory EvaluationBookReportResult.fromJson(Map<String, dynamic> json) =>
      EvaluationBookReportResult(
        status: json["status"],
        message: json["message"],
        result: Result.fromJson(json["result"]),
      );

  Map<String, dynamic> toJson() => {
        "status": status,
        "message": message,
        "result": result?.toJson(),
      };
}

class Result {
  Result({
    this.summary,
    this.limit,
    this.count,
    this.page,
    this.list,
  });

  EvaluationBookReportSummary? summary;
  int? limit;
  int? count;
  int? page;
  List<EvaluationBookReport>? list;

  factory Result.fromJson(Map<String, dynamic> json) => Result(
        summary: EvaluationBookReportSummary.fromJson(json["summary"]),
        limit: json["limit"],
        count: json["count"],
        page: json["page"],
        list: List<EvaluationBookReport>.from(
            json["list"].map((x) => EvaluationBookReport.fromJson(x))),
      );

  Map<String, dynamic> toJson() => {
        "summary": summary?.toJson(),
        "limit": limit,
        "count": count,
        "page": page,
        "list": List<dynamic>.from(list!.map((x) => x.toJson())),
      };
}

class EvaluationBookReportSummary {
  EvaluationBookReportSummary({
    this.listeningAccuracy,
    this.readingWrongArray,
    this.speakingAiScore,
    this.readingAccuracy,
    this.listeningWrongArray,
    this.speakingScore,
    this.completedCount,
    this.writingScore,
  });

  int? listeningAccuracy;
  List<ReadingWrongArray>? readingWrongArray;
  int? speakingAiScore;
  int? readingAccuracy;
  List<ListeningWrongArray>? listeningWrongArray;
  int? speakingScore;
  int? completedCount;
  int? writingScore;

  factory EvaluationBookReportSummary.fromJson(Map<String, dynamic> json) =>
      EvaluationBookReportSummary(
        listeningAccuracy: json["listeningAccuracy"],
        readingWrongArray: List<ReadingWrongArray>.from(
            json["readingWrongArray"]
                .map((x) => ReadingWrongArray.fromJson(x))),
        speakingAiScore: json["speakingAIScore"],
        readingAccuracy: json["readingAccuracy"],
        listeningWrongArray: List<ListeningWrongArray>.from(
            json["listeningWrongArray"]
                .map((x) => ListeningWrongArray.fromJson(x))),
        speakingScore: json["speakingScore"],
        completedCount: json["completedCount"],
        writingScore: json["writingScore"],
      );

  Map<String, dynamic> toJson() => {
        "listeningAccuracy": listeningAccuracy,
        "readingWrongArray":
            List<dynamic>.from(readingWrongArray!.map((x) => x.toJson())),
        "speakingAIScore": speakingAiScore,
        "readingAccuracy": readingAccuracy,
        "listeningWrongArray":
            List<dynamic>.from(listeningWrongArray!.map((x) => x.toJson())),
        "speakingScore": speakingScore,
        "completedCount": completedCount,
        "writingScore": writingScore,
      };
}

class ListeningWrongArray {
  ListeningWrongArray({
    this.limitTime,
    this.question,
    this.kind,
    this.topic,
    this.id,
    this.label,
    this.type,
    this.content,
  });

  int? limitTime;
  List<QuestionItem>? question;
  String? kind;
  String? topic;
  String? id;
  String? label;
  String? type;
  QuestionContent? content;

  factory ListeningWrongArray.fromJson(Map<String, dynamic> json) =>
      ListeningWrongArray(
        limitTime: json["limitTime"],
        question: List<QuestionItem>.from(
            json["question"].map((x) => QuestionItem.fromJson(x))),
        kind: json["kind"],
        topic: json["topic"],
        id: json["id"],
        label: json["label"],
        type: json["type"],
        content: QuestionContent.fromJson(json["content"]),
      );

  Map<String, dynamic> toJson() => {
        "limitTime": limitTime,
        "question": List<dynamic>.from(question!.map((x) => x.toJson())),
        "kind": kind,
        "topic": topic,
        "id": id,
        "label": label,
        "type": type,
        "content": content!.toJson(),
      };
}

class ReadingWrongArray {
  ReadingWrongArray({
    this.limitTime,
    this.question,
    this.kind,
    this.topic,
    this.id,
    this.label,
    this.type,
    this.content,
  });

  int? limitTime;
  List<QuestionItem>? question;
  String? kind;
  String? topic;
  String? id;
  String? label;
  String? type;
  QuestionContent? content;

  factory ReadingWrongArray.fromJson(Map<String, dynamic> json) =>
      ReadingWrongArray(
        limitTime: json["limitTime"],
        question: List<QuestionItem>.from(
            json["question"].map((x) => QuestionItem.fromJson(x))),
        kind: json["kind"],
        topic: json["topic"],
        id: json["id"],
        label: json["label"],
        type: json["type"],
        content: QuestionContent.fromJson(json["content"]),
      );

  Map<String, dynamic> toJson() => {
        "limitTime": limitTime,
        "question": List<dynamic>.from(question!.map((x) => x.toJson())),
        "kind": kind,
        "topic": topic,
        "id": id,
        "label": label,
        "type": type,
        "content": content!.toJson(),
      };
}
